{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "3d43c1b1-454a-4aec-8e33-6d1ae314a5ca",
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "d1aa6c6a-2b2e-4063-8cef-c34655e87da5",
   "metadata": {},
   "outputs": [],
   "source": [
    "t = torch.tensor([[1, 2, 3], [4, 5, 6]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "793d0805-4428-48a1-9ecf-57f34af7e53f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([[1, 2, 3],\n",
      "        [4, 5, 6]]) torch.int64 torch.Size([2, 3])\n"
     ]
    }
   ],
   "source": [
    "print(t, t.dtype, t.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "1ccb5f1c-a141-4595-aa10-e0544b3eceba",
   "metadata": {},
   "outputs": [],
   "source": [
    "T = torch.Tensor([[1, 2, 3], [4, 5, 6]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "50576eea-453c-47ee-ae77-78c71edaffd9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([[1., 2., 3.],\n",
      "        [4., 5., 6.]]) torch.float32 torch.Size([2, 3])\n"
     ]
    }
   ],
   "source": [
    "print(T, T.dtype, T.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "9ac7bd07-7d28-4bc3-a82b-412497da80c8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([1, 2, 3, 4, 5, 6])"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "t1 = torch.tensor([1,2,3])\n",
    "t2 = torch.tensor([4,5,6])\n",
    "t3 = torch.cat([t1, t2])\n",
    "t3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "4f81b619-40dd-47d2-a816-049ba0601915",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[1, 2, 3],\n",
       "        [4, 5, 6]])"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "t4 = torch.stack([t1,t2])\n",
    "t4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "cef0ee37-f2e6-4dca-bc87-f68fb9ca05ad",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[1, 2, 3],\n",
       "        [4, 5, 6]])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "t"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "a3b17d7c-83b4-492f-aa13-9e833468136b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[1, 2],\n",
       "        [3, 4],\n",
       "        [5, 6]])"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "t.view((3, 2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "278ee445-a445-4577-875f-1815e846c5be",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[1, 2, 3],\n",
       "        [4, 5, 6]])"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "t"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "04d1a273-73c0-48ca-ae59-351a3eac08d4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[3, 4, 5],\n",
       "        [3, 4, 5]])"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "t1 = torch.tensor([1,2,3])\n",
    "t2 = torch.tensor([[2,2,2],[2,2,2]])\n",
    "t3 = torch.add(t1, t2)\n",
    "t3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "11e3455b-3ac6-4929-b36f-da8fdf44f781",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[2, 4, 6],\n",
       "        [2, 4, 6]])"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "t4 = torch.mul(t1, t2)\n",
    "t4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fd9feb2a-438b-4935-a162-7a17270c2cce",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.19"
  },
  "widgets": {
   "application/vnd.jupyter.widget-state+json": {
    "state": {},
    "version_major": 2,
    "version_minor": 0
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
